# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=xtl
pkgver=0.7.7
pkgrel=0
pkgdesc="The x template library"
url="https://github.com/xtensor-stack/xtl"
arch="noarch"
license="BSD-3-Clause"
makedepends="cmake samurai doctest-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/xtensor-stack/xtl/archive/refs/tags/$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DBUILD_TESTS="$(want_check && echo ON || echo OFF)" \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}


sha512sums="
07c2a68db3dbac556dbb0397e54792ddc7a3e87573bff04faa4262dc433b710392ff9c915d428f5abd1ae892ac9bc7744645e75fdb2bb2cee83c523e087c793e  xtl-0.7.7.tar.gz
"
